package com.ruoyi.leif.service.impl;

import java.util.List;

import com.ruoyi.leif.domain.BaseWarehouse;
import com.ruoyi.leif.mapper.BaseWarehouseMapper;
import com.ruoyi.leif.service.IBaseWarehouseService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 仓库Service业务层处理
 * 
 * @author leif
 * @date 2025-06-13
 */
@Service
public class BaseWarehouseServiceImpl implements IBaseWarehouseService
{
    @Autowired
    private BaseWarehouseMapper baseWarehouseMapper;

    /**
     * 查询仓库
     * 
     * @param id 仓库主键
     * @return 仓库
     */
    @Override
    public BaseWarehouse selectBaseWarehouseById(String id)
    {
        return baseWarehouseMapper.selectBaseWarehouseById(id);
    }

    /**
     * 查询仓库列表
     * 
     * @param baseWarehouse 仓库
     * @return 仓库
     */
    @Override
    public List<BaseWarehouse> selectBaseWarehouseList(BaseWarehouse baseWarehouse)
    {
        return baseWarehouseMapper.selectBaseWarehouseList(baseWarehouse);
    }

    /**
     * 新增仓库
     * 
     * @param baseWarehouse 仓库
     * @return 结果
     */
    @Override
    public int insertBaseWarehouse(BaseWarehouse baseWarehouse)
    {
        baseWarehouse.setCreateTime(DateUtils.getNowDate());
        return baseWarehouseMapper.insertBaseWarehouse(baseWarehouse);
    }

    /**
     * 修改仓库
     * 
     * @param baseWarehouse 仓库
     * @return 结果
     */
    @Override
    public int updateBaseWarehouse(BaseWarehouse baseWarehouse)
    {
        baseWarehouse.setUpdateTime(DateUtils.getNowDate());
        return baseWarehouseMapper.updateBaseWarehouse(baseWarehouse);
    }

    /**
     * 批量删除仓库
     * 
     * @param ids 需要删除的仓库主键
     * @return 结果
     */
    @Override
    public int deleteBaseWarehouseByIds(String[] ids)
    {
        return baseWarehouseMapper.deleteBaseWarehouseByIds(ids);
    }

    /**
     * 删除仓库信息
     * 
     * @param id 仓库主键
     * @return 结果
     */
    @Override
    public int deleteBaseWarehouseById(String id)
    {
        return baseWarehouseMapper.deleteBaseWarehouseById(id);
    }
}
